package top.yangyitao.lockManager.lock.zookeeper;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
import top.yangyitao.lockManager.lock.manager.ThreadLocalLockManager;

/**
*   @author: eetal
*   @Date: 2019/10/5 20:30
*   @Description: 分布式环境下zookeeper基于TLS原理的lockManager
*/
@Component
@ConditionalOnProperty(name = "lock-manager.type",havingValue = "zookeeper")
public class ZookeeperLockManager extends ThreadLocalLockManager {

    @Override
    public ZookeeperLockSubject create(Object obj) {
        ZookeeperLockSubject zookeeperLockSubject = new ZookeeperLockSubject();
        zookeeperLockSubject.initialize(obj);
        getLockSet().add(zookeeperLockSubject);
        return zookeeperLockSubject;
    }
}
